package jdklearning.reflect.method;

import java.lang.reflect.Method;


/**
 * @author shenenlu 2021年06月18日 上午11:52:23
 */
public class SyntheticMethod {

    private String h = "hello";
    private class B {
        private B(){
            System.out.println(h);//访问外部类私有字段，会生成一个方法，这句话实现：
            //System.out.println(Main.access$000(var1));
        }
    }
    public void test(){
        System.out.println("B : " + B.class.isSynthetic());
    }


    public static void main(String[] args) throws Exception{
        SyntheticMethod syntheticMethod = new SyntheticMethod();
        syntheticMethod.test();
        Method[] methods = SyntheticMethod.class.getDeclaredMethods();
        for(Method method : methods){
            if(method.isSynthetic()){
                System.out.println("name = " + method.getName());
            }
        }
    }


}
